<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <div id="app">
    <home1></home1>
    <hr>
    <home2></home2>
  </div>
  <script src="./vue.js"></script>
  <script>
    // 定义一个子组件options
    const Child = {
      template: `
        <div>
          <h3>这是一个子组件头部</h3>
          <slot></slot>
          <h3>这是一个子组件尾部</h3>
        </div>
      `
    }

    const Home1 = {
      template: `
        <div>
          <h2>这是home1组件</h2>
          <child>
            <div>
              <button>按钮</button>
              <i>aaaa</i>
            </div>
          </child>
        </div>
      `,
      components: {
        Child
      }
    }
    Vue.component('Home1', Home1);
    const Home2 = {
      template: `
        <div>
          <h2>这是home2组件</h2>
          <child>
            <div>
              <mark>按钮</mark>
            </div>
          </child>
        </div>
      `,
      components: {
        Child
      }
    }
    Vue.component('Home2', Home2)
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>
</html>